package com.jt.controller;

import com.jt.pojo.Rights;
import com.jt.service.RightsService;
import com.jt.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author SWJ
 * @create 2021-08-05 14:34
 */
@RestController
@CrossOrigin
//demo测试 获取全部列表信息
@RequestMapping("/rights")
public class RightsController {
    @Autowired
    private RightsService rightsService;

    //demo测试 获取全部列表信息

    @RequestMapping("/getAll")
    public List<Rights> getAll(){

        return rightsService.getAll();
    }


    /**
     * 需求: 查询2级菜单结构,并且封装为List集合
     * URL: /rights/getRightsList
     * 参数: 暂时没有
     * 请求类型: get
     * 返回值: SysResult对象(list集合)
     */

    //查询左侧2级菜单
    @GetMapping("/getRightsList")
    public SysResult getRightsList(){

   List<Rights>rightsList=rightsService.getRightsList();
   return SysResult.success(rightsList);


    }
}
